Blessed Pius IX (Encyclical Singulari Quidem):
Dz.1647 For, it MUST be held BY FAITH that outside the Apostolic Roman Church, no one can be saved; that this is the only ark of salvation; that he who shall not have entered therein will perish in the flood; but, on the other hand, it is necessary to hold for certain that they who labor in ignorance of the true religion, if this ignorance is invincible, are not stained by any guilt in this matter in the eyes of God. (Denzinger)
Blessed Pius IX (Encyclical Quanto Conficiamur Moerore)
Dz.1677 And here, beloved Sons and Venerable Brothers, We should mention again and censure a very grave error in which some Catholics are unhappily engaged, who believe that men living in error, and separated from the true faith and from Catholic unity, can attain eternal life [see n. 1717]. Indeed, this is certainly quite contrary to Catholic teaching. It is known to Us and to you that they who labor in invincible ignorance of our most holy religion and who, zealously keeping the natural law and its precepts engraved in the hearts of all by God, and being ready to obey God, live an honest and upright life, can, by the operating power of divine light and grace, attain eternal life, since God who clearly beholds, searches, and knows the minds, souls, thoughts, and habits of all men, because of His great goodness and mercy, will by no means suffer anyone to be punished with eternal torment who has not the guilt of deliberate sin. But, the Catholic dogma that no one can be saved outside the Catholic Church is well-known; and also that those who are obstinate toward the authority and definitions of the same Church, and who persistently separate themselves from the unity of the Church, and from the Roman Pontiff, the successor of PETER, to whom “the guardianship of the vine has been entrusted by the Savior,” * cannot obtain eternal salvation. (Denzinger)