Upvote:2
Can I travel with single entry Schengen visa to Mexico,
Yes. According to https://www.inm.gob.mx/gobmx/word/index.php/paises-requieren-visa-para-mexico/ a visa national who is the holder of a valid and current Schengen visa can enter Mexico.
and do I need to visit a Schengen county before going to Mexico
As commented by @Leaderboard, If you visit a Schengen country with a single entry visa before going to Mexico, the visa is no longer valid, so that would be a no.