Like Robert pointed out, this problem is related to Stokes problem, a limiting case of the incompressible Navier-Stokes equation.
For Arbitrary dimension as you first asked, you could refer to this paper, in $\mathbb{R}^3$, the existence of a vector potential to solve the divergence equation can be found here.
For $\mathbb{R}^2$, I am looking at the book by Girault and Raviart now, the complete results of the function spaces related to divergence operator can be found from page 22, and they are like an application of De Rham's work in cohomology.
$\newcommand{\v}[1]{\boldsymbol{#1}}$
Basic idea is for any smooth vector fields $\v{v}$ in $\mathbb{R}^2$, there exists a decomposition
$$
\v{v} = \mathbf{grad} \phi + \mathbf{curl} \psi
$$
if the boundary of domain of interest has certain smoothness(say Lipschitz). Say if your problem is to find $\v{v}$ such that
$$
\left\{
\begin{aligned}
\mathrm{div} \v{v} &= f \text{ in } \Omega
\\
\v{v} &= \v{g} \text{ on } \partial\Omega
\end{aligned}
\right.
$$
Plugging the decomposition would enable you to establish a Neumann problem of Laplace equation for $\phi$, and any $\psi \in H^1$ that has a zero boundary condition would satisfy $\mathbf{curl} \psi \cdot \v{n} = 0$ on boundary.