Studying surface reactions using ultrafast optical pump and x-ray probe experiments relies on accurate calculations of x-ray spectra of adsorbates for the correct identification of the spectral signatures and their dynamical evolution. We show that experimental x-ray absorption can be well reproduced for different binding sites in a static prototype system CO/Ni(100) at a standard density functional theory generalized-gradient-approximation level of theory using a plane-wave basis and pseudopotentials. This validates its utility in analyzing ultrafast x-ray probe experiments. The accuracy of computed relative core level binding energies is about 0.2 eV, representing a lower limit for which spectral features can be resolved with this method. We also show that the commonly used Z + 1 approximation gives very good core binding energy shifts overall. However, we find a discrepancy for CO adsorbed in the hollow site, which we assign to the significantly stronger hybridization in hollow bonding than in on-top.