The photoluminescence of indium phosphide has been measured on crystals in ultrahigh vacuum and subsequently oxidized in a controlled manner. The luminescence intensity can vary by more than an order of magnitude and shows a close correspondence to the known shift of the Fermi level at the surface under oxidation. We conclude that the oxidation-induced surface space charge layer is nonradiative due to the presence of the electric field. The band bending and surface charge variation can be estimated quantitatively from the data. The influence of surface contamination on Schottky barrier formation is also reported.