Perhaps Onesiphorus was alive and simply away from home. So Paul had an urge to pray for his companion's family. What the text does indicate is that the two were not together. As this resource explains:
"Knowing that even these good deeds could not save Onesiphorus and his house, the apostle asks the Lord to show mercy to his friend — to keep him in the grace of God that he might persevere until the very end."
This makes perfect sense because Christianity was persecuted under the Roman Empire. A prayer for perseverance to the end would, by definition, mean that he was still alive. Even if Onesiphorus was dead at this point in time, that would only mean the apostle was petitioning God to show mercy to the man and his family on the Day of Judgement. After all, he was very beneficial to Paul during his ministry. He wanted his household to be blessed as a result of his faithfulness and loyalty. This scenario would be similar to King David blessing the household of Jonathon and his descendants (2 Samuel 9:1-7). Paul would essentially be expressing a hope for Onesiphorus to be resting in peace. These comments from English divine and scholar Edward Hayes Plumptre are insightful here:
"It is, at any rate, clear that such a simple utterance of hope in prayer, like the Shalom (peace) of Jewish, and the Requiescat or Refrigerium of early Christian epitaphs, and the like prayers in early liturgies, though they sanction the natural outpouring of affectionate yearnings, are as far as possible from the full-blown Romish theory of purgatory."
Onesiphorus received complete forgiveness of sins at the moment of his conversion. If he was dead when Paul wrote 2 Timothy, then his fate was already sealed. No amount of prayers could possibly alter or help his eternal destiny. Paul was neither praying to him nor supporting the idea of anybody else doing such. He was not praying that Onesiphorus would be released from purgatory or anything in those lines.