Carbon contamination is a notorious issue in surface science, especially in near-atmospheric conditions. Using APXPS we analysed the build-up of carbon on a rutile $TiO_2(110)$ single crystal when exposed to vapour and liquid water. Factors such as beam illumination, gas composition, and interaction with liquid water are shown to affect surface contamination. X-ray irradiation locally increases the amount of carbon, while environmental conditions determine the initial overall contamination level. Introducing molecular oxygen can induce surface cleaning under irradiation. Our results support the hypothesis of progressive removal of carbon from chamber walls by competitive adsorption of water molecules following repeated exposure of the vacuum chamber to water vapour.