We investigate the effects of doping on the formation energy and concentration of oxygen vacancies at a metal-oxide surface, using MgO(100) as an example. Our approach employs density-functional theory, where the performance of the exchange-correlation functional is carefully analyzed, and the functional is chosen according to a condition on density-functional theory ionization energies. The approach is further validated by coupled-cluster calculations, including single, double, and perturbative triple substitutions, for embedded clusters. We demonstrate that the concentration of oxygen vacancies at a doped oxide surface is largely determined by the formation of a macroscopically extended space-charge region.