Ancelotti rules out Pirlo-Alonso swap deal
Both players are out of contract at the end of the season and have been linked with moves away from their respective clubs.
Alonso – who limped out of Spain's 2-1 win over Equatorial Guinea with an ankle knock – is seen as a vital member of the Italian's squad, and with Sami Khedira suffering a long-term knee injury, the 31-year-old is expected to be a regular starter.
Pirlo played for Ancelotti at Milan and the Madrid coach admitted he has remained in contact with the midfielder, but denied he was considering a move for the 34-year-old.
"Xabi is a vital player for Madrid now that he's recovered from injury," he told Mediaset. "There are only two players like him in Europe. One is Pirlo and the other is Xabi.
"However, we have no intention of making a player exchange deal with Juventus. There is no substance to any rumour like that.
"I am still in touch with Andrea because I have a good relationship with him. I was pleased to see the Madrid fans give him a warm welcome when we met."
Pirlo moved to Juventus in 2011 and has helped guide them to back-to-back Serie A titles under Antonio Conte.