Recall Gauss’ theorem, $ \int\int\int_V (\vec{\nabla} \cdot \vec{F}) dV = \int\int_{S} (\vec{F} \cdot \vec{e}_{n}) dS $. This theorem can be written more precisely. The following statement of the Divergence theorem is a copy from reference [1]. Definitions are provided first.
Volume $ V$: Define $ V$ as a region comprising three spatial dimensions. The volume has no holes in it.
Boundary $ \partial V$: Define $ \partial V$ as a once-differentiable surface surrounding the volume $ V$. The boundary has a thickness of zero and no holes in it. Points not in $ V$ are not in $ \partial V,$ and the boundary $ \partial V$ is comprised of points in $ V$.
Area Vector $ \vec{a}$: Define $ \vec{a}$ as the vector that is perpendicular to the tangent plane at a point on the boundary $ \partial V$. The area vector points away from the center of the volume $ V$. The magnitude of $ \vec{a}$ is equal to the area of $ \partial V$ that has $ \vec{a}$ perpendicular and outward-pointing.
Unit Area Vector $ \vec{e}_a$: Define $ \vec{e}_a \equiv \frac{\vec{a}}{a}$.
Dummy Variable $ d \vec{a}$: Define $ d\vec{a} \equiv \vec{e}_a da $.
Divergence Theorem: Let $ V$ be a region in space with boundary $ \partial V$. Then the volume integral of the divergence $ \vec{\nabla} \cdot \vec{F}$ of $ \vec{F}$ over $ V$ and the surface integral of $ \vec{F}$ over the boundary $ \partial V$ of $ V$ are related by $ \int_V ( \vec{\nabla} \cdot \vec{F} ) dV = \int_{\partial V} \vec{F} \cdot d\vec{a}$.
Deriving this theorem for a generic surface is very difficult due to complications arising from the curvature of surfaces, so I will prove this theorem for the simplest possible case in which the volume $ V$ is a rectangular prism centered at the origin of an arbitrary coordinate system. After all, why should one need an arbitrary shape? I hope that a rectangular prism will work for all the cases that will be encountered.
It helps to draw the situation, so the proof is handwritten.


References
[1] https://mathworld.wolfram.com/DivergenceTheorem.html
[2] http://www.math.ncku.edu.tw/~rchen/Advanced%20Calculus/divergence%20theorem.pdf