The diverse coordination environment on the surface of carbon-based nanomaterials contributes significantly to their unique adsorption properties. Here, we perform firstprinciples calculations to determine the sensitivity and selectivity of pristine, 1B, and homonuclear 2B-doped graphdiyne, pentagraphene, and phagraphene structures toward toxic phosgene (COCl 2 ) gas molecule. The strength of the phosgene gas adsorption on the perfect surfaces is negligible, while the substitution of homonuclear boron on the studied substrates can make inert carbon allotropes into an active material for capturing the COCl 2 gas molecule. Further, the charge density difference and Lowdin charge analysis were computed to provide additional insights for understanding the phenomenon clearly, and the results are completely consistent with the observed trends. The prominent changes in the electronic structure of homonuclear boron-doped surfaces indicate strong reactivity toward phosgene gas molecules, thereby inducing significant variations in the conductivity or resistivity of the sensing device. The π electron occupancy is correlated with the sensing of carbon materials toward phosgene. Overall, homonuclear 2B-doped graphidyne and 1B/2B-doped pentagraphene display high selectivity and sensitivity with better performance, which makes them potential candidates toward target phosgene gas molecules. These fundamental atomic-scale insights may furnish novel outcomes into the rational design of defect engineered carbon-based nanomaterials for the detection of toxic phosgene gas molecules.