Is it possible to use some version of finite element method in a fluid problem (for example Stokes or Navier--Stokes problem) in a bounded domain $\Omega\subset\mathbb{R}^d$ with an obstacle (velocity on the obstacle equal to zero) in $\mathbb{R}^{d-1}$?
As example, Can I use Finite element when the domain is a square and the obstacle (where the velocity is equal to zero) is a line? I think it is not possible, but I would like to know why it is not possible, and if there is some trick or special version of the Finite Element method to address these types of problems.

I think there is nothing preventing you to solve such a problem.
In fact, I tried to do this using the Python-based finite element package scikit-fem. I solved Stokes flow with a parabolic profile $y(1-y)$ on the left and the right boundaries for the x-component of the velocity (bottom left corner is the origin). Otherwise the velocity is zero on the boundary. Here are the x- and y-components of the velocity:
I used the lowest order Taylor-Hood element. A more refined mesh would be needed near the corner to better resolve the x-component of the velocity.