"The Hagia Sophia is in Istanbul."
It's "Ayasofya İstanbul'dadır." because the -da/-de ending uses 2-way vowel harmony. Since İstanbul's last vowel is "u", you must use -da to agree with vowel harmony. When the last vowel of a word is a, u, o, or ı, you use the ending with an "a". When the last vowel of a word is e, i, ö, or ü you use the ending with an "e". For example, to say "at the hotel", you say "otelde" because the last vowel of "otel" is e, but you say " İstanbul'da" because the last vowel of "İstanbul" is "u". Also, the " ' " in İstanbul'dadır is because İstanbul is a proper noun (the name of a city). Proper nouns need a " ' " before their endings.