I'm trying to determine the electrostatic potential caused by a specified charge density function: $$ \rho_c(\vec{r}) =\begin{cases} 1 & \vec{r} \in V\\ 0 & \text{otherwise} \end{cases} $$
The solution using Green's function is then: $$ \phi(\vec{r}) = \iiint_{V} \frac{\rho_c(\vec{r}')}{4 \pi \epsilon_0 \|\vec{r}-\vec{r}'\|} d \vec{r}' $$
I can understand how this integral can be easily evaluated so long as $\vec{r} \not\in V$ since there is no singularity in the integral, however I don't know how to resolve the integral if $\vec{r} \in V$, since this appears to cause the integral to become infinite/undefined.
Suppose for a concrete example that $V$ is an axis-aligned rectangular prism with opposing corners at $(x_0,y_0,z_0)$ and $(x_1,y_1,z_1)$. How do I find $\phi(\vec{r})$ inside of this box, and how do I generalize that procedure to any arbitrary $V$?