Never wanting to reinvent the wheel, I’ve opted, with the author Most Rev. Charles Brusca’s permission, to provide the following link to his website discussing Baptism of Desire.
Following is a very thorough presentation by Bishop Brucca titled “There is No Contradiction Between ‘There is no Salvation Outside the Catholic Church’ & ‘Baptism of Desire'”.
Finally, from Bishop Brusca’s website, we read:
The Baltimore Catechism (1885) did not raise Baptism of Desire to the status of a defined proposition of the Faith — that had been done over three hundred years earlier at the Council of Trent.
The doctrine was discussed in the Decree on Justification, Session VI, 3 January 1547, Chapter IV (Denzinger 796/1524). It is cited in “anathema” form by the Session VII, 3 March 1547, Canon 4 (Denzinger 847/1604). It is mentioned in the Tridentine Catechism, pars II, caput II, No. 36. But even those teachings before Trent about Baptism of Desire that might be called speculative come from very well accepted Catholic authorities including Ambrose, Augustine, Aquinas, and Popes Innocent II and III.
Had Vatican I been left to its business in peace, we might have heard more from Pope Pius IX, who, while holding strictly to the necessity of belonging to the Church, admitted the possibility that those in “invincible ignorance of the true religion” might attain eternal life by devotedly following the principles of the natural law (Cf. Quanto conficiamur moerore, Denzinger 1677/2865). Later revisions to The Baltimore Catechism (c.1940) seem to incorporate this thinking (Q.323)