Ich danke der Frau
Why is 'der' used in the above sentence instead of 'die'?
There are a few verbs like this. I think of it like this: Thanking isn't something you're doing to die Frau, but rather, you're engaged in the act of expressing thanks, and it happens to be directed at der Frau. To me, it implies that der Frau is not necessarily changed/affected by the fact that you're saying "thanks", which seems appropriately humble.
German nouns and pronouns have different forms ("cases") depending on the role they play in a sentence. In your sentence, there is a subject (= someone who is actively doing something): "Ich". The subject of a sentence is always in a grammatical form called "nominative case".
Then there is also an object in your sentence (= someone who is the passive "victim" of an action): "Frau". Normally, a direct object is in the so-called "accusative case". However, after a very limited number of verbs, the dative case is used for the direct object. Among these verbs are: danken (to thank), helfen (to help), antworten (to answer). Since you have the verb "danken" in your sentence, the dative case ("der Frau") is used for the direct object.
For more on the German cases, see: