I read somewhere that it is favorable to pray upstairs compared to ground level or downstairs in the basement but I am not sure if this is true.

When I pray upstairs, is it acceptable to pray facing a window where one can see outside through that window?

The main reason I am asking is: if a car drives by in front of me, would I have to repeat my prayer? Or is it no problem because I am inside and they are outside the house?

The actual issue is that, that the place of Namaz should not be narrow or should not be as if anyone wants to stand can’t stand properly. So the place we pray should be like that where we can easily sit and stand therefore it has said that it is makrooh to offer namaz inside the store room or in banker like that place or in a room which is dark or inside the kitchen or at the main entrance (gate or door) or a place where people are moving easily in front of you or a place which is sandy or too much soft (like mattress) etc. And it has logic behind it because these things can distract us. But as you said praying Namaz in a room facing to window has no issue even if it’s open and cars are passing but if you see this can cause you to loose your concentration then better put on the curtain. But your Namaz is okay even if there is no curtain too.