"We passed the mosque."
Translation:Wir kamen an der Moschee vorbei.
Because that's how you say it in German.
vorbei is not a preposition, but you need some kind of preposition here before the noun; vorbei is used together with an in this situation.
Ich gehe an der Schule vorbei (I walk past the school), wir kommen am Postamt vorbei (we'll pass the post office), etc.
What's the difference between vorbeikommen and vorbeigehen? The Duden seems to say they are synonymous, but is there a different implication to using one or the other? In English, for example, "we're coming by" would imply that you are coming close to the mosque on your way to somewhere else, but you plan to stop in and say hi, or whatever. But "we're going by" would imply that you will be passing near it, but won't stop. Is the same the case for German?