1. First establish that the noun is known to be ghayr munsarif; do not guess from spelling or from being a name.
2. In its basic form, do not add tanwin.
3. Use dammah for nominative and fathah for accusative.
4. In the genitive without ال or idafah, use fathah: بِمَسَاجِدَ.
5. In the genitive with ال, use kasrah: بِالْمَسَاجِدِ.
6. When it is genitive and mudaf, use kasrah: فِي مَسَاجِدِ اللهِ.
Always check the grammatical context before selecting the ending.