Is there a hadith in which it says that a man prostrated before the Prophet (blessings and peace of Allah be upon him) and the Prophet (blessings and peace of Allah be upon him) told him not to do that?

Praise
be to Allah

The Companions of the Prophet (blessings and peace of Allah
be upon him) used to honour him and venerate him, and venerate his Sunnah.
In the early days of Islam, when some of them saw that the People of the
Book prostrated to their bishops and patriarchs, they thought that the
Prophet (blessings and peace of Allah be upon him) was more deserving of
that, out of respect for him and veneration of him. But the Prophet
(blessings and peace of Allah be upon him) forbade them to prostrate to him.

Ibn Maajah (1853) and al-Bayhaqi (14711) narrated that
‘Abdullah ibn Abi Awfa said: When Mu‘aadh ibn Jabal came from Syria, he
prostrated to the Prophet (blessings and peace of Allah be upon him), who
said, “What is this, O Mu‘aadh?” He said, I went to Syria and saw them
prostrating to their archbishops and patriarchs, and I wanted to do that for
you. The Messenger of Allah (blessings and peace of Allah be upon him) said,
“Do not do that. If I were to command anyone to prostrate to anyone other
than Allah, I would have commanded women to prostrate to their husbands. By
the One in Whose hand is the soul of Muhammad, no woman can fulfil her duty
towards Allah until she fulfils her duty towards her husband. If he asks her
(for intimacy) even if she is on her camel saddle, she should not refuse.” 

This version was narrated by Ibn Maajah, and was classed as
saheeh by al-Albaani in Saheeh Ibn Maajah

Abu Dawood (2140) and al-Haakim (2763) narrated that Qays ibn
Sa‘d (may Allah be pleased with him) said: I went to al-Heerah and saw them
prostrating to a noble of theirs (i.e., a courageous knight who was
prominent among them). I thought: The Messenger of Allah (blessings and
peace of Allah be upon him) is more deserving that people should prostrate
to him. So I came to the Messenger of Allah (blessings and peace of Allah be
upon him) and said: I went to al-Heerah and saw them prostrating to a noble
of theirs, but you are the Messenger of Allah (blessings and peace of Allah
be upon him) and are more deserving that people should prostrate to you. He
said: “Do not do that. If I were to instruct anyone to prostrate to anyone,
I would have instructed women to prostrate to their husbands, because of the
rights that Allah has given them over them.” 

Classed as saheeh by al-Haakim, and adh-Dhahabi agreed with
him. Also classed as saheeh by al-Albaani in Saheeh Abi Dawood

Ibn Hibbaan (4162) narrated from Abu Hurayrah that the
Messenger of Allah (blessings and peace of Allah be upon him) entered one of
the gardens of the Ansaar, where he saw two restless camels. The Messenger
of Allah (blessings and peace of Allah be upon him) draw close to them and
they knelt down and lay their necks on the ground. Those who were with him
said: They have prostrated to him. The Messenger of Allah (blessings and
peace of Allah be upon him) said: “It is not appropriate for anyone to
prostrate to anyone else. If it were appropriate for anyone to prostrate to
anyone else, I would have instructed the wife to prostrate to her husband,
because of the great rights that Allah has given him over her.”

Classed as hasan by al-Albaani in Irwa’ al-Ghaleel
(7/54) 

Thus the Prophet (blessings and peace of Allah be upon him)
explained to them that prostration should only be to Allah, and that
venerating people and honouring them should not be done by prostrating to
them. 

Shaykh Ibn Baaz (may Allah have mercy on him) said:

Prostration is for Allah alone, and the law of Muhammad
(blessings and peace of Allah be upon him) is the most perfect and most
complete of laws, according to which it is not permissible to prostrate to
anyone or anything other than Allah, either by way of greeting or by way of
worship. As for worship, it cannot be devoted to any except Allah alone,
according to all laws and teachings, but in the past prostration was used as
a greeting and by way of honouring people, as the parents and brothers of
Yoosuf did, and as the angels did to Adam. This was by way of greeting and
showing respect, not by way of worship. But according to the law of Muhammad
(blessings and peace of Allah be upon him), Allah, may He be glorified and
exalted, has forbidden that and has made prostration for Allah alone, may He
be glorified and exalted; it is not permissible to prostrate to anyone else,
either the Prophets or others, to the extent that Muhammad (blessings and
peace of Allah be upon him) forbade anyone to prostrate to him and stated
that prostration is for Allah alone, may He be glorified and exalted. 

End quote from Fataawa Noor ‘ala ad-Darb (4/112-113) 

For more information on the issue of prostrating to anyone or
anything other than Allah, please see the answer to question no.
229780 

And Allah knows best.