The Einstein relation for a driven moderately dense granular gas in $d$-dimensions is analyzed in the context of the Enskog kinetic equation. The Enskog equation neglects velocity correlations but retains spatial correlations arising from volume exclusion effects. As expected, there is a breakdown of the Einstein relation $epsilon=D/(T_0mu) eq 1$ relating diffusion $D$ and mobility $mu$, $T_0$ being the temperature of the impurity. The kinetic theory results also show that the violation of the Einstein relation is only due to the strong non-Maxwellian behavior of the reference state of the impurity particles. The deviation of $epsilon$ from unity becomes more significant as the solid volume fraction and the inelasticity increase, especially when the system is driven by the action of a Gaussian thermostat. This conclusion qualitatively agrees with some recent simulations of dense gases [Puglisi {em et al.}, 2007 {em J. Stat. Mech.} P08016], although the deviations observed in computer simulations are more important than those obtained here from the Enskog kinetic theory. Possible reasons for the quantitative discrepancies between theory and simulations are discussed.