An optimal estimation based retrieval scheme for satellite based retrievals of XCO<sub>2</sub> (the dry air column averaged mixing ratio of atmospheric CO<sub>2</sub>) is presented enabling accurate retrievals also in the presence of thin clouds. The proposed method is designed to analyze near-infrared nadir measurements of the SCIAMACHY instrument in the CO<sub>2</sub> absorption band at 1580 nm and in the O<sub>2</sub>-A absorption band at around 760 nm. The algorithm accounts for scattering in an optically thin cirrus cloud layer and at aerosols of a default profile. The scattering information is mainly obtained from the O<sub>2</sub>-A band and a merged fit windows approach enables the transfer of information between the O<sub>2</sub>-A and the CO<sub>2</sub> band. Via the optimal estimation technique, the algorithm is able to account for a priori information to further constrain the inversion. Test scenarios of simulated SCIAMACHY sun-normalized radiance measurements are analyzed in order to specify the quality of the proposed method. In contrast to existing algorithms for SCIAMACHY retrievals, the systematic errors due to cirrus clouds with optical thicknesses up to 1.0 are reduced to values below 4 ppm for most of the analyzed scenarios. This shows that the proposed method has the potential to reduce uncertainties of SCIAMACHY retrieved XCO<sub>2</sub> making this data product potentially useful for surface flux inverse modeling.