In a regular bentching a child would say "ES AVI MORI BAL HABAYIS HAZEH" or in your own home "OSI V'ES ISHTI/BALI" what about a bachur in a Yeshiva dining room, or a person in a restaurant or a non Jewish college cafeteria?
I asked a rabbi this question once. (related to a slightly different part of bentching, where we say "al hashulchan hazeh, val h bayit hazeh" about benching on a Tiyul outdoors as well as other places like shuls and school. He told me not to change the nusach. And then told me in addition, that the 'Baal habayit' in each place still exists, even if the place is not exactly a "house", or you are not sitting at a literal "table".
On a tiyul, it is the person who funded the paths to be constructed. At a yeshiva it is the owner of the yeshiva, at a public place, it is the owner of the building. You still need to be thankful to the people who made the place where you are eating possible. Or possibly the person who bought the food for you to eat.
I've heard that this is a very flexible Nusaḥ.
A Baḥur in Yeshivah should say "Kol HaMesubin Kan".
In a public place someone could say "Kol Bnei Berith HaMesubin Kan" but it is unnecessary.
Regardless of where one is, even in one's own home, one could say "Eth Avi Mori, etc."
Regarding what some others have mentioned about why we say it, I believe this is a (relatively) recent development in the Ashkenazi world. By that I mean that the Gemara and Shulḥan 'Aruch provide a text of a Yehi Ratzon to say as a guest at someone else's table, which is printed in a slightly different version in a "this is optional" gray box in the Artscroll Siddur, and which is becoming increasingly popular to say (at least in some circles). According to a rebbi I had in high school, it's not at all clear why the Yehi Ratzon fell into disuse, but it's perfectly acceptable to say it and/or the HaRaḥaman.
Many Sepharadim say some version of the Yehi Ratzon.
In accordance with the above, again, according to what I've heard, the exact text of the HaRaḥaman can be altered to fit the situation. You can bless your hosts, your colleagues, your parents (even if you're not dependent on them or living in their home), your spouse, your children, or anyone you like. Having said that, again in accordance with the above, you should bless whoever is sponsoring your meal, whether it is the host or someone who brought the meal or paid for it in some capacity (you could say "Ba'al(ath) HaSe'udah HaZoth", for example). I know of at least one version of Bentching that supposedly follows the custom of R' Sa'adyah Gaon, which has a series of blessings for virtually everyone in attendance at the meal, their spouses, their parents, their children, their future children, etc.