I knew there was a pope who taught to not pray for those who died outside of the Church, so I asked Magisterium AI:
The pope was St. Gregory the Great (Pope Gregory I, 590–604).
He taught that the Church should not pray for those known with certainty to be damned, comparing this with the fact that Christians do not pray for the devil and his angels. St. Thomas Aquinas quotes Gregory’s Moralia:
“There is the same reason why we do not pray now for the devil and his angels, who are condemned to eternal punishment, as why the saints do not pray now for wicked and unbelieving men who have died, since they know that they are condemned to eternal punishment.”