Spatial correlations in nonequilibrium systems: The effect of diffusion