Let $\partial \mathcal{S}$ be a simple closed curve and $\mathcal{S}$ the region enclosed by it, with $\mathcal{S} \subset \mathbf{R}^3$. Let $\vec{F}$ be a vector field in $\mathbf{R}^3$.
If $\mathcal{S}$ is contained in the $x$-$y$ plane and $\vec{F}$ has only $x$ and $y$ components, one can check that \begin{equation} \int_{\partial \mathcal{S}} \vec{F} \times \mathrm{d} \vec{l} = \hat{n}\int_\mathcal{S} \nabla \cdot \vec{F} \, \mathrm{d}x \, \mathrm{d}y \, , \end{equation}
where $\hat{n}$ is given by the right-hand-screw rule in relation to the sense of the line integral around $\partial \mathcal{S}$. This is just another application of Stokes' Theorem.
I have tried to find the appropriate generalization for $\mathcal{S}$ and $\vec{F}$ not constrained to live in a plane, with $\partial \mathcal{S}$ still a simple closed curve. When I try to work the result using the standard form of Stokes' theorem and vector identities I get \begin{equation} \int_{\partial \mathcal{S}} \vec{F} \times \mathrm{d} \vec{l} = \int_\mathcal{S}\left[ ( \nabla \cdot \vec{F} ) \hat{n}- \left( \nabla F_i \right) n_i \right]\, \mathrm{d}s \, , \end{equation} with implicit summation over $i$. This seems to be consistent with the 2D case and I think it works but I could not find it elsewhere and I wanted to make sure if this is right. I would be very grateful if you could let me know if you agree.