In Special Relativity, the continuity equation for electric charge is $$\frac{\partial \rho}{\partial t}+\text{div}\left( \mathbf{j}\right)=0.$$
Is there a generalization of this equation in general relativity? A reference would be very helpful.
Yes, there is. However, let us first rewrite the expression you wrote in a way that's more suitable for working with Relativity. For simplicity, I'll employ units with $c=1$. Let us write $\rho = j^0$ and $t = x^0$. Then your expression becomes $$\frac{\partial j^0}{\partial x^0} + \text{div}(\mathbf{j}) = \frac{\partial j^0}{\partial x^0} + \frac{\partial j^1}{\partial x^1} + \frac{\partial j^2}{\partial x^2} + \frac{\partial j^3}{\partial x^3} = 0.$$
This can be written simply as $$\partial_\mu j^\mu = 0.$$
As with most expressions in Special Relativity that get transported to GR, it can be generalized by changing the partial derivatives to covariant derivatives, so one gets $$\nabla_\mu j^\mu = 0.$$
This is an expression of local conservation of electric charge. As for a reference, Wald's General Relativity discusses a bit about the formulation of Electromagnetism in curved spacetime on Chapter 4 and deriving this expression from the curved spacetime version of Maxwell's equations is that chapter's Problem 1.
Remark: it should be mentioned that the expression I wrote hold for charge due to the particular behavior of electric charge under changes of reference frame. If we were dealing with, for example, mass or energy, then the appropriate expression would be the conservation of the stress-energy-momentum tensor, $\nabla_\mu T^{\mu\nu} = 0$.
The best way to formulate an equation is through tensorial formulation, that way you are sure that it is in its covariant form. As for the continuity equation, it's covariant formulation would be through introduction of the 4-current $j^\mu$ whre $j^0=\rho$ and $j^i=\mathbf{j}$. The continuity equation is given by its conservation, \begin{equation} \partial_{\mu}j^{\mu}=0. \end{equation}
A more general formulation of the continuity equation would be the conservation of the stress energy tensor, \begin{equation} \nabla_{\mu}T^{\mu\nu}=0. \end{equation}
Given the right expression of your stress energy tensor, you can derive the continuity equation as was written in your question. You can check this example.