Niobium hydride is a suspected contributor to degraded niobium superconducting radio-frequency (SRF) cavity performance by Q slope and Q disease. The concentration and distribution of hydrogen atoms in niobium can be strongly affected by the cavity processing treatments. This study provides guidance for cavity processing based on density functional theory calculations of the properties of common processing impurity species-hydrogen, oxygen, nitrogen, and carbon-in the body-centered cubic (bcc) niobium lattice. We demonstrate that some fundamental properties are shared between the impurity atoms, such as anionic character in niobium. The strain field produced, however, by hydrogen atoms is both geometrically different and substantially weaker than the strain field produced by the other impurities. We focus on the interaction between oxygen and hydrogen atoms in the lattice, and demonstrate that the elastic interactions between these species and the bcc niobium lattice cause trapping of hydrogen and oxygen atoms by bcc niobium lattice vacancies. We also show that the attraction of oxygen to a lattice vacancy is substantially stronger than the attraction of hydrogen to the vacancy. Additionally hydrogen dissolved in niobium tetrahedral interstitial sites can be trapped by oxygen, nitrogen, and possibly carbon atoms dissolved in octahedral interstitial sites. These results indicate that the concentration of oxygen in the bcc lattice can have a strong impact on the ability of hydrogen to form detrimental phases. Based on our results and a literature survey, we propose a mechanism for the success of the low-temperature annealing step applied to niobium SRF cavities. We also recommend further examination of nitrogen and carbon in bcc niobium, and particularly the role that nitrogen can play in preventing detrimental hydride phase formation.