I'm pretty new in a DDD world and I'm wondering how to handle a situation where I have one aggregate root (AggregateRootA) which needs some information from other aggregate root (AggregareRootB) to be able to do something (e.g. change state of AggregateRootA).
Maybe this will be more clear if I try to use more real world scenario... Lets consider a reservation system. In the system we have Reservation aggregate root and Resource aggregate root. Resource has Available/Unavailable state. The system permits to create a reservation and adds resources to it (in code its done by refering by Id of course). The next step is to accept the reservation and in this step the reservation has to check if its all resources are in available states. Lets say that it can't be done in the adding step or just that resource changed its state when it was already in reservation. How to perform such validation?
I came up with a solution where Reservation could have access to ResourceRepository but as I found out AggregateRoot should not be allowed to have such access in a DDD.
My second idea was to move validation to ApplicationService but such validation for me looks like domain logic so it should be placed in a domain model.
My last thoughts were that maybe I should write dedicated DomainService to handle this situation but again... should DomainService have access to Repositories?
I think you are closing in on the point in your last paragraph but the question is not that should a DomainService have access to Repository, it's more of a question about could it have (in your technical implementation)? Evaluate the pros and cons of the approach on a technical basis, and if nothing truly bad comes up, do it. To me, it seems that is what your brain keeps telling you to do anyway.
Then as time goes by and your understanding of the surrounding domain, bounded context, language, etc. gets better (and it will), you can always remodel and refactor. Nothing is set in stone.