En las dependencias anexas a ellas se albergaba a huespedes ilustres. Why do they say "a ellas" here?
en las dependencias anexas a ellas se albergaba a huespedes ilustres
Excellent, thank you! The whole context was: Las ermitas eran otro elemento frecuente en el jardín. No tenían un carácter únicamente religioso, pues en las dependencias anexas a ellas se albergaba a huéspedes ilustres.
so a ellas was about las ermitas I suppose
It is all about los jardines del Buen Retiro in Madrid.
and what is the role of "a ellas" in this sentence?
Welcome to SpanishDict, psychosynergy!
The Spanish word "ellas" basically means "them" and could refer to people (women) or it could refer to objects (buildings, etc.) In this case, more context is needed to identify with certainty why "ellas" was used in this particular sentence. If you need more help, just post additional details and someone will gladly assist.
I hope that helps, and we look forward to seeing you around the Forum!
"in units attached to them are housed famous guests"
this is the translation i nenglish