The Maxwell's equation $\boldsymbol{\nabla}\cdot \textbf{E}(\textbf{r})=\frac{\rho(\textbf{r})}{\epsilon_0}$ is derived from the Gauss law in electrostatics (which is in turn derived from Coulomb's law). Therefore, $\textbf{E}$ must be an electrostatic field i.e., time-independent. Then how is this equation valid for the electric field $\textbf{E}(\textbf{r},t)$ which is time-dependent (for example, the electric field of an electromagnetic wave)? Can we prove that $\boldsymbol{\nabla}\cdot \textbf{E}(\textbf{r},t)=\frac{\rho(\textbf{r},t)}{\epsilon_0}$ ?
EDIT: I have changed $\boldsymbol{\nabla}\cdot \textbf{E}=0$ to $\boldsymbol{\nabla}\cdot \textbf{E}=\frac{\rho}{\epsilon_0}$ in the question.