The general rule is that verbs with two accusative objects are very rare (albeit verbs with two dative objects are even rarer). Thus, if there is an additional object accompanying the reflexive pronoun — which would typically be in accusative case — the reflexive pronoun takes the other case — typically dative. See the following examples:
(non-reflexive, no object)
Ich wasche die Hände.
(non-reflexive, accusative object ‘What are you washing?’)
Ich wasche mich.
(reflexive; no second object thus accusative case. Again think ‘Who (or what) are you washing?’)
Ich wasche mir die Hände.
(reflexive; second object thus dative case. Think ‘What am I washing?’, and ‘whom am I washing the hands?’)