If you do a ship's tour they will stop in places where there are restrooms.
Another way to do it is go to a bar enjoy a drink and then ask to use the facilities. I have been in Mexico, Costa Rica, Panama, Honduras and Colombia and we always found decent facilities without any problem
Carnival Liberty New Year's Eve 2007
Liberty of the Seas 5/2008+11/2009
Allure 1/16/ 2011
Vision OTS 2-14-2015
Freedom OTS 3/6/16