Can I connect my water heater pan drain to the building waste drain? (CPC)
An Approved location that I'm aware of is like a Floor Drain. Though Ariel is Correct, you would need an Air Gap. So the pipe would have a 1" min Gap to the Drain so that any back flow of water could not touch the exit pipe.   The Main issue here is keeping the sewer gases in the system and not outside. This is what the p-Trap is for.  Its a water barrier to prevent sewer gases from escaping the system. The Water Heater Drain pan does not typically have water and any p-Trap installed in that line would not have any water in it to fill the p-Trap. 

My HVAC system is in the Attic and it sits in a large drain pan so if the AC leaks water will drain out. They plumbed the 3/4" PVC drain to a Soffit vent over a window. The purpose for the over the window was it would be obvious to someone that there was a leak. 

Hope that helps.