We established a stress-history-dependent porosity model of potential target rocks for CO2 geosequestration based on rock sample porosity measurements under various effective stresses (5 - 120 MPa). The measured samples were collected from shallow boreholes (< 300 m depth) drilled at the frontal fold in northern Taiwan. The lithology, density, and the stress-history-dependent porosity derived from shallow boreholes enabled us to predict the porosity-depth relationship of given rock formations at (burial depths of approximately 3170 - 3470 m) potential sites for CO2 geosequestration located near the Taoyuan Tableland coastline. Our results indicate that the porosity of samples derived from laboratory tests under atmospheric pressure is significantly greater than the porosity measured under stress caused by sediment burial. It is therefore strongly recommended that CO2 storage capacity assessment not be estimated from the porosity measured under atmospheric pressure. Neglecting the stress history effect on the porosity of compacted and uplifted rocks may induce a percentage error of 7.7% at a depth of approximately 1000 m, where the thickness of the eroded, formerly overlying formation is 2.5 km in a synthetic case. The CO2 injection pressure effect on the porosity was also evaluated using the stress-history-dependent porosity model. As expected, the pore pressure buildup during CO2 injection will induce an increase in the rock porosity. For example, a large injection pressure of 13 MPa at a depth of approximately 1000 m will increase the rock porosity by a percentage error of 6.7%. Our results have implications for CO2 storage capacity injection pressure estimates.