The incorporation of impurities during the chemical synthesis of nanomaterials is usually uncontrolled and rarely reported because of the formidable challenge that constitutes measuring trace amounts of often light elements with sub nanometre spatial resolution. Yet these foreign elements influence functional properties, by e.g. doping. Here we demonstrate how the synthesis and partial reduction reaction on hollow TiO2 nanowires leads to the introduction of parts-per-millions of boron, sodium, and nitrogen from the reduction reaction with sodium borohydride at the surface of the TiO2 nanowire. This doping explains the presence of oxygen vacancies at the surface that enhance the activity. Our results obtained on model metal-oxide nanomaterials shed light on the general process leading to the uncontrolled incorporation of trace impurities that can have a dramatic effect on their potential use in energy-harvesting applications.