Question:
Let $r=\sqrt {x^2+y^2+z^2}$ and $\mathbf E = -\mathbf \nabla \big(\frac kr \big)$ where $k$ is a constant. Show that
$$ \iint_S \mathbf E \cdot d \mathbf S = 4\pi k$$
where $S$ is any closed surface that encloses the origin.
The hint was to first show this for $S$ being a sphere centered at origin, then use the divergence theorem to show this for general $S$.
Doing this for sphere surface was easy, but then when I tried to use the Divergence Theorem I got
$$ \iint_S \mathbf E \cdot d \mathbf S = \iiint_V \nabla \cdot \mathbf E dV =0$$
because $\nabla \cdot \mathbf E =0$, and I realized that this was because $\mathbf E$ has a blowup at the origin so that the Divergence Theorem did not apply.
Any hints as to what I should do? Is there a version of the Divergence Theorem that accounts for singularities?
The divergence theorem applies to a body $B$, its boundary $\partial B$, and a vector field $E$ sufficiently smooth on $B\cup\partial B$.
Your surface $S$ bounds a body $B$ containing the origin in its interior. Now apply the divergence theorem to the body $B':=B\setminus B_\epsilon$ and $E$, where $B_\epsilon$ is a tiny ball around the origin. The boundary of $B'$ is $S-S_\epsilon$ (minus sign intended!).