Anyone who explicitly rejects the Gospel and the Church cannot achieve salvation. All salvation comes from Christ and the Church is the visible sign and instrument of that salvation.
There are a few ways that the issue of atheism can be addressed.
Firstly, when many people reject God they are rejecting a certain idea of God and not God Himself. It is as if someone told you all sorts of things about someone named James that sounded horrible to you so you determined that you did not like James and would never be friends with him. However, one day you meet James and discover that he is nothing like what the other person told you about him. You discover that you really do want to be friends with James. Your rejection therefore was never really of James but of a certain idea of James. James (if he was all good, loving, and merciful as God is) would certainly not hold that against you and would welcome your friendship.
Secondly, imagine someone didn’t just tell you bad things about James but someone did bad things to you and claimed that James told him to do those things to you. In such a situation you would certainly not like James or want to be around him. However, once the confusion is cleared up James would certainly blame the person who did those things to you and made those claims rather than hold it against you.
Thirdly, there are some people who simply don’t care who James is or what he’s like. They willfully do not care to know anything about him. These people will never be able to enter into a friendship with James.
This comes down to how to we define faith. Does faith always need to be explicitly stated? How much does someone need to understand the faith to qualify as believing? What if everything they believe is essentially describing God as taught by Jesus but they have a different understanding, is it simply “a rose by another name?”
The Church teaches that faith can sometimes be implicit, a kind of subconscious faith. Such individuals do not have all the terminology or theology but they truly strive after the things that are divine and submit themselves to it the best that they can. Not every church going Catholic is a theological scholar yet we don’t set a bar that needs to be passed for theological knowledge to have true faith. The simple desire to submit oneself to what is truly good is enough of a starting point because only God is good (Luke 18:9). From there we expect each person to embrace the deeper truths of the faith as he or she is able.
Some atheists have the most basic level of faith though they do not know or understand it, however the Church teaches that God’s grace is still active in their lives:
Those who, through no fault of their own, do not know the Gospel of Christ or his Church, but who nevertheless seek God with a sincere heart, and, moved by grace, try in their actions to do his will as they know it through the dictates of their conscience – those too may achieve eternal salvation. (Catechism, 847)
“Although in ways known to himself God can lead those who, through no fault of their own, are ignorant of the Gospel, to that faith without which it is impossible to please him, the Church still has the obligation and also the sacred right to evangelize all men.” (Catechism, 848)
The reason the Church still evangelizes such individuals is so that they can be brought into a more explicit faith and a deeper communion with God and his people.
For further reading: Fr. Thomas Rosica’s Reflections on Atheists, Christians, and Who Will Be Saved