No, it is not. You would have to use "in der Nähe von der Stadt", because it is genitive. But most notably the "it was great" refers to the "apartment" and the German "Wohnung" is feminine, so you need "sie".
Your English sentence contains "thought", so it would be "dachte" in German, but probably that's up to you if you want to translate it that way. Here's a problem: If your sentence continues as "I thought it was ..., BUT" you have to use Konjunktiv.
Please also note that you need a comma before "weil" (it is a so-called Subjunktion).
So your sentence would be:
Wir sind in einer Wohnung geblieben. Ich dachte, dass sie prima war, weil sie in der Nähe von der Stadt war.
But if you ask for a well-formed sentence I would recommend (also showing the other interpretation):
Wir waren in einem Apartment untergebracht. Ich hielt es für sehr gut, weil es in der Nähe der Stadt lag, aber...