In my day job I'm in construction. From contractor to arch/eng inspector to spec writer I've got about 30 years in now, and I know that a LOT of people don't know much about where they live. Your backstops can vary quite a bit.
Without patronizing anyone, most residential walls are made of wood or metal studs (vertical) with gypsum board spackled and sanded. THAT's all you get. If a bullet hits a stud there's a good chance it will stop. BUT... Most residential buildings have plywood on the outside of the studs, under the siding, but not all. I've seen many tract-built places that have gyp board inside, studs, FOAM, and vinyl siding. You could probably shoot a K-Mart toy arrow through a wall like that. They often put plywood on the corners, but a REALLY strong person or a guy on crack might be able to bust right through your wall if he didn't hit a stud. Of course, same with a bullet.
The good news with townehouses and condos is if they are in rows, most state building codes require fire walls between each unit. These are often concrete block walls which makes a pretty good backstop. But some use shaftwalls, which meet the code for fire separation, but basically it's a minimal frame with one to two inches of gyp board on each side....not a good backstop.
If you have older homes...many from the early 60's on back to the 30's, you probably have wood siding (often covered by vinyl or asbestos) and the sheathing beneath (where the plywood would be on a more modern building) is often old school 1X...7/8" thick lumber. The older houses werent' much on insulation, but they often have a harder gyp board or lath and plaster, which won't stop a bullet, but it will slow one down, espectially an expanding jacket, hollow point, or frangible. You've got a decent chance of not harming your neighbors in a structure like that if you don't hit it "WRONG"...the bullet will get stopped, deflected, or at least slowed down, so maybe it goes across the street and dents your neighbor's lawn jockey instead of blowing his head off.
From the 30's back you've probably got wood siding, 1" thick sheathing beneath, NO insulation, and lath with plaster that can be as much as an inch and a quarter thick. Same as the category above.
In our neighborhood we all watch out for each other(at least the locals do) and self-defense also means neighbor defense. Like MB says, you should plan your defensive positions based on your backdrops, and approach home defense from those positions. If you've got exposure problems though, think about the physics. You want to destroy enemy flesh and bone, but not friendlies...
In NJ if I shoot an armed father-raper in my home with hollow points, that is malicious intent and I might go to jail. I can OWN them and shoot them, but if I shoot a person with them, I'm being malicious by using the hollow point, even though it might stop in my wall instead of going across the street and killing my neighbor. So you have to size everything up.
If you can use them, hollow points will not penetrate building materials as far as hardball ammo will. Expanding jacket should also fatten out even more and slow down. OR...what we keep at home is soft point...just lead. It will certainly hurt the bad guy but maybe it will flatten out enough in the wall to fall harmless out in my front yard. There's always frangible too. I don't know how bad the penetration statistics are with frangible ammo, but it's got to at least HURT the hell out of the bad guy when you lay a few rounds into him.
The kind of planning and practice that Michael talks about all the time is the only way to minimize the risks, but many of us are forced by circumstance to use ammo that may not be considered the "best" defense ammo in the industry.