Step 1: Understanding the Concept:
Solubility of a gas in water depends on how strongly the gas interacts with water. Gases that react with water, or can hydrogen bond with it, dissolve very well. Nonpolar, unreactive gases dissolve very little.
Step 2: Key Formula or Approach:
Compare the interaction of each gas with water at the same temperature and pressure.
Step 3: Detailed Explanation:
\(\text{NH}_3\) forms hydrogen bonds with water and reacts to form \(\text{NH}_4^+\) and \(\text{OH}^-\), so it is extremely soluble.
\(\text{HCl}\) ionises completely in water to give \(\text{H}_3\text{O}^+\) and \(\text{Cl}^-\), so it is also extremely soluble.
\(\text{CO}_2\) is nonpolar but reacts partly with water to form carbonic acid, so it dissolves much more than an unreactive gas (about one volume per volume of water).
\(\text{N}_2\) is nonpolar, has a very stable triple bond and does not react with water. Only weak dipole-induced dipole forces act, so its solubility is the lowest (about 0.02 volume per volume).
Final Answer:
Dinitrogen is the least soluble gas, which is option (D).
\[ \boxed{\text{N}_2 \text{ (D)}} \]