Hybridization of carbon in CO2
Hybridization is determined by molecular geometry. Carbons participating in triple bonds like those in acetylene have two regions of electron density. Carbon dioxide is a linear molecule, and also has two regions of electron density. The fact that both have two regions of electron density are what make these carbons $\mathrm{sp}$ hybridized.

To reenforce hybridization is determined by molecular geometry, consider the benzyne intermediate. It has a triple bond, but is $\mathrm{sp^2}$ hybridized because it is too strained to become linear and only have two regions of electron density.