Inside buildings you're usually protected from cars, but not always. There are some pedestrian paths that are physically separated from cars, sometimes by miles (as with hiking trails), and some roadways where no pedestrians are allowed within several yards (as with limited-access highways). There are also simple sidewalks, where the raised curb marks the boundary between car territory and pedestrian territory (but is often violated). Sometimes the government will build a fence or bollards to keep the cars on their side, and sometimes the cars parked at the curb form a barrier.
Sooner or later, pedestrian paths and car paths have to cross, and there are all kinds of ways to arrange this. One example comes from Streetsblog commenter Rhywun:
The only "developing" country I've been to is China and I can verify that the streets are pretty much a free-for-all--and the drivers win. Big cities like Shanghai and Beijing address the problem of out-of-control drivers with giant pedestrian overpasses all over the place, which lends these areas all the grace of an airport parking lot.
I've never been to China, but I have been to other cities with pedestrian overpasses and underpasses, and we even have some here in New York. Most of the ones in New York go over and under limited-access highways, and there probably shouldn't be limited-access highways in a city anyway.
There are other overpasses that cross roads that are theoretically "streets" or "boulevards" with sidewalks and shops. Examples include the West Street overpasses to Battery Park City and the Queens Boulevard underpasses in Forest Hills. While they may prevent individual pedestrians from being killed, they also allow the cars to go faster, driving pedestrians away from the sidewalks, and making the street feel less safe to walk along. This sets up a vicious cycle where walkable street uses lose business and close up, giving pedestrians less reason to walk, which in turn encourages drivers to go faster, and on and on.
Grade separation can be even more extreme, for example with the second-story walkway systems that exist in places like Calgary, and the underground walkways of Montreal and Chicago. During very cold (or sometimes very hot) weather, these places provide a sheltered alternative to the street, but in more comfortable seasons they draw pedestrians away from the streets, allowing them to be more dominated by cars than they would otherwise.
Barriers and separation are definitely necessary in the short term to protect pedestrians from motorists and cyclists, and to protect cyclists and pedestrians from motorists. Underground walkways, skyways, greenways and hiking trails definitely have their uses, and it seems like we're stuck with limited-access highways for now. But in keeping with our goals, we want to reduce the amount of car usage. Unless and until we can come up with non-car alternatives for every automotive use for an area (including deliveries and transportation for the disabled), we will need to accommodate cars. Generally, that means allowing cars, cyclists and pedestrians to mix, and that requires other ways of protecting the vulnerable.