Landau proved that the mean density of integers of the form $a^2+b^2$ up to $x$ is $K\frac{x}{\sqrt{\log x}} (1+o(1))$, where $K$ is an explicit constant. One proof is based on the fact that a prime $p$ is of this form iff $p\neq 3\mod 4$, and so we can express the generating function for these integers in terms of the zeta function and the $L$-function of the non-trivial character modulo $4$. From there one proceed using complex analysis.
For integers of the form $a^2 + nb^2$, one should have similar results. We know what primes has this form by class field theory, and then in principle one can continue as before.
I am sure this is classical, but unfortunately I've failed to find it in the literature (including google). Does anyone know a reference for this?