Were there indulgences sold for those who had no family when they died? The book Martin Luther: A Life by James A. Nestingen describes the indulgences around the time of 1517, and says that they could be bought for oneself or others, typically family members.

An indulgence takes the place of some other form of penance. So, having undertaken a pilgrimage or made some other sacrifice, financial or otherwise, the penitent could obtain indulgences that could be used to satisfy penalties for oneself or for a deceased soul. […]
The slogan [used by John Tetzel to sell indulgences] was, “When a coin in the coffee rings, a soul from purgatory to heaven springs,” and it came complete with lurid portrayals of dead relatives waiting urgently in purgatory for someone to buy their release.

It’s clear that indulgences were sold to individuals for the benefit of their deceased family members. But were they ever sold for the benefit of people who had no family?
For instance, if an orphan or a widow died and there were no family members alive to buy an indulgence, would people in their community be encouraged to buy indulgences on their behalf? Similarly, would indulgences be bought on behalf of nondescript people, like “someone who has been forgotten and has no family members to buy an indulgence”?
Yes, they were. I'm not sure about generic, nondescript people, but they were sold to friends of the dead. Tetzel apparently marketed to all people indiscriminately, encouraging them to purchase indulgences for anyone they knew who had passed. *The Jesuit Priest in the Family, the Church, and the Parish: In reply to a Letter by W.H. Anderson says this on page 86:


  Tetzel also asserted that Indulgences not only saved the living, but also the dead. He used, likewise, to harangue his auditory in such strains as, "Priest! noble! merchant! wife! young girls! young men! hear your departed parents, and other friends, crying to you from the bottom of the abyss! 'We are enduring horrible torments! A little alms would deliver us; you can give it, yet you will not!'"


Emphasis is the author’s, bold text is mine. Credit is due to Tis_Bearself from Catholic Answers for this answer.