From Lee's introduction to smooth manifolds: $\DeclareMathOperator{\div}{div}$
The Divergence Theorem. Let $M$ be an oriented Riemannian manifold with boundary. For any compactly supported smooth vector field $X$ on $M$, $$\int_M\div X=\int_{\partial M}\langle X,n\rangle,$$ where $n$ is the outward-pointing unit normal vector field along $\partial M$.$^1$
Here $\partial M$ denotes the manifold boundary and thus this doesn't include the common scenerio where $M\subset N$ is an open subset of a manifold $N$ without boundary (e.g. $N=\mathbb{R}^n$) and $\partial M=\overline{M}\setminus M$ is the topological boundary. What about this case? Is the equation still correct? What are the precise requirements? Are there any references?
$^1$ Since $M$ and $\partial M$ are both Riemannian manifolds, we have a measure on both sets and hence we can integrate real valued functions.