(a) "The daughter of the colonel who had a black dress left the party."
(b) "The daughter of the colonel who had a black mustache left the party."
(c) "The daughter of the colonel who had a black hat left the party."
(a), (b), and (c) are grammatical, but, while (a) and (b) are understandable, I have some difficulties in understanding (c); more precisely, in (c) it is unclear, at least to me, whether the hat is the colonel's hat or the daughter's hat.
I wonder if it exists a grammar rule to decipher (c).
I searched for grammatical proximity without any useful result.