Normally, sanctification begins with baptism, the sacrament of faith. However, this faith can be present apart from baptism and, where there is some impediment preventing baptism and there is at least an implicit desire for baptism, this faith can suffice to sanctify if animated by charity.
But without faith, there can be no holiness. As the Council of Trent teaches: “faith is the beginning of human salvation, the foundation and root of all justification, without which it is impossible to please God.”
In light of the this, the Catechism of the Catholic Church says:
161 Believing in Jesus Christ and in the One who sent him for our salvation is necessary for obtaining that salvation.42 "Since “without faith it is impossible to please [God]” and to attain to the fellowship of his sons, therefore without faith no one has ever attained justification, nor will anyone obtain eternal life ‘But he who endures to the end.’"43
Since God desires all to be saved and come to knowledge of the truth (cf. 1 Tim. 2:4), He therefore must make the possibility of knowing the truth (Christ, who says “I am the way, and the truth, and the life” (John 14:6)) and coming to salvation concretely possible for all. As such, the Church teaches “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.”
As Pope Francis put it in an encyclical letter (Lumen Fidei):
Because faith is a way, it also has to do with the lives of those men and women who, though not believers, nonetheless desire to believe and continue to seek. To the extent that they are sincerely open to love and set out with whatever light they can find, they are already, even without knowing it, on the path leading to faith…Any-one who sets off on the path of doing good to others is already drawing near to God, is already sustained by his help, for it is characteristic of the divine light to brighten our eyes whenever we walk towards the fullness of love.
One who is united with the Church in faith and charity, even if not socially or manifestly a member, is not “outside the Church” and therefore can be made holy and saved.