We have studied the segregation of P and B impurities during oxidation of the Si(100) surface by means of combined static and dynamical first-principles simulations based on density functional theory. In the bare surface, dopants segregate to chemically stable surface sites or to locally compressed subsurface sites. Surface oxidation is accompanied by development of tensile surface stress up to 2.9 N/m at a coverage of 1.5 monolayers of oxygen and by formation of oxidised Si species with charges increasing approximately linearly with the number of neighbouring oxygen atoms. Substitutional P and B defects are energetically unstable within the native oxide layer, and are preferentially located at or beneath the Si/SiO x interface. Consistently, first-principles molecular dynamics simulations of native oxide formation on doped surfaces reveal that dopants avoid the formation of P-O and B-O bonds, suggesting a surface oxidation mechanism whereby impurities remain trapped at the Si/SiO x interface. This seems to preclude a direct influence of impurities on the surface electrostatics and, hence, on the interactions with an external environment.