There are two honorary consulates of Mexico in Pakistan. While they are not authorized to issue visas, they can certainly guide you on where you need to apply for the visa. The link is given below:
https://embamex.sre.gob.mx/iran/index.php/en/2016-05-27-11-35-32/honorary-consul
Regarding your friend being denied boarding, please note that you need both a Mexico visa for tourism and a Tourist Card, also known as the Forma Migratoria Múltiple (FMM). As per IATA website for Pakistani passport holders
Visa Exemptions: Passengers with a multiple-entry visa issued by
Canada, Japan, USA, United Kingdom or a Schengen Member State for a
maximum stay of 180 days.
Warning: Visitors not holding return/onward tickets could be refused
entry.
There have been many issues of people using the Mexico route to illegally cross into the US. In other cases I know of where people were denied boarding, it was because they weren't able to convince that they were legitimately going to Mexico - for instance, having booked a hotel for the number of days they will be staying, enough money, and a fully paid return ticket. Like the US, a Mexican visa only lets you go to Mexico but an immigration officer will decide to let you enter or not. Some basic requirements are checked by the airline so they do not have to bear the burden of deporting the passenger.