In this paper, we extend Walsh's stochastic integral with respect to a Gaussian noise, white in time and with some homogeneous spatial correlation, in order to be able to integrate some random measure-valued processes. This extension turns out to be equivalent to Dalang's one. Then we study existence and regularity of the density of the probability law for the real-valued mild solution to a general second order stochastic partial differential equation driven by such a noise. For this, we apply the techniques of the Malliavin calculus. Our results apply to the case of the stochastic heat equation in any space dimension and the stochastic wave equation in space dimension d = 1, 2, 3. Moreover, for these particular examples, known results in the literature have been improved.