It's horrible what your ex is doing to try and make your daughter reject you. This is what happens with an alienating ex. You're right you need to find ways to handle and manage it. The first advice is usually don't get into a dialogue with the child about it. It makes them more conflicted because they have loyalty to both parents. It's good that she told you what the ex said so you understand what is going on. It's not working - your daughter isn't rejecting you, but she is carrying out instructions without understanding why. This is why the time is so important - if she's with you, you can handle things and gradually she will learn some coping strategies. If you don't see your daughter, then this kind of thing becomes more and more ingrained.
No you can't discuss it with the ex because - well it's too bizarre isn't it when she is deliberately creating this. So you have to manage the situation.
I've had a similar situation and it's very stressful and worrying and you can't quite be yourself as you have to tread so gently.
The first thing to think about is what is happening to the child. The child is suffering - they are under stress. So you do right not to get angry. Is it worse on arrival and then improves the next day?
The main thing is - distraction. If she comes out with a hostile or provocative statement (and you need to be prepared for this), you don't react - you say nothing, you listen for a second and then you carry on as if nothing has happened and use distraction. Change the subject, act and sound normal - go to the other room to get some food or whatever, or say - it's time we were going out to get some things. Or even put the TV on. They can't keep doing it if you don't react. Then she will settle down and her mind will become her own again as you do something hands on or watch something together. It might mean getting out of the house more if domestic routine doesn't make it easy for her to relax.
Some lines you can develop that aren't directly criticial of the ex. I don't know which ones would apply in your situation, but these were ones I had to use at various times
"Mummy must be mistaken"
"I'm not sure why Mummy would say that" (if she asks)
"People do things differently in different houses - in this house we are nice and kind to each other".
I had a few confrontational things "Mummy's better at this than you". To that you raise an eyebrow and agree - it really works! Yes I am sure she is - now lets have some ice cream. Change the subject - move to a different room - whatever. It disarms them because they expect you to react or be upset or angry.
Other lines are - be empathetic. This one was given to me by a parenting professional and it worked well. "I know things must be hard for you - are you coping ok". You're not addressing the behaviour or what she is saying - you are just showing you understand she is struggling and show you care. I'm not sure how well that one would work with a 5 year old.
There's also a book I'll link that helped me cope - I carried it round in my pocket I was so desperate.
Basically there is collusion. A 5 year old doesn't understand that but it's collusion about Dad - maybe she is making nasty jokes about you or saying bad stuff about you and then saying - lets show Dad this and you be badly behaved with him. I'm just guessing, but basically your ex is inciting this behaviour in a child - to get at you. And it's harmful.
The main thing right now is - she is there with you. I found it can wear off in 24 hours and they become a normal happy child again. Is she nervous about looking happy before she goes back?
This kind of thing is very difficult to deal with as it's hard to prove what's going on which is why so much of the help for handling alienated children is about managing the behaviour and teaching critical thinking.
Being with you is the most important thing because it's a place of normality and she is away from the toxic influence.
Have a read of this book though - it's a quick easy read - short chapters that can be read on their own so you can dip in and out. the Kindle version is the cheapest but I found with the paper copy I went through underlining things and writing in the margin - so I could keep going back to it and reminding myself what was going on.
The author is an expert in PA. The title of the book isn't very appetising but it's all about how to manage the behaviours when the ex is trying to alienate the child.
Co-parenting with a Toxic Ex: What to Do When Your Ex-Spouse Tries to Turn the Kids Against You eBook : Baker, Amy J. L., Fine, Paul R: Amazon.co.uk: Kindle Store
www.amazon.co.uk