Effects of local environment on the sensitivity of surface‐enhanced Raman scattering have been recently considered as an important issue in experiments involving charge‐transfer mechanism between the adsorbed molecules and the metal surface. To theoretically investigate this issue, we consider the complexation ofp‐hydroxybenzoic acid (PHBA) andp‐mercaptobenzoic acid (PMBA) with carbon dioxide (CO2), and in contact with silver (Ag), by means of ab initio calculations. Within the Møller–Plesset perturbation theory, it is demonstrated that the carboxylic group of PHBA or PMBA can act as an electron‐donating site, binding the electron‐deficient carbon atom of CO2, via a Lewis acid–base (LA–LB) interaction. Changes in the vibrational spectra of these molecules are carefully determined and attributed to both LA–LB complexation with CO2and interaction with Ag. Calculated Raman scattering shifts for the complexes also indicate that the chemical nature of the substituent group atparaposition of the aromatic ring can dramatically alter the signal of typical shifts expected for LA–LB complexes, as well as affect surface‐enhanced Raman scattering intensities. The LA–LB complexation is also reinforced by the ultraviolet–visible absorption spectra for the complexes, calculated within time‐dependent density functional theory and combined with the polarizable continuum model, employed to simulate the local environment dielectric constant. It is demonstrated that the lowest singletπ–π* excitation of both LA–LB complexes, PHBA and PMBA weakly bound to CO2, is significantly red shifted, which gives evidence for such a complexation. Copyright © 2016 John Wiley & Sons, Ltd.