How can a Zigbee coordinator send commands in large networks (greater than 240 devices) to nodes?
If the maximum amount of endpoints on any ZigBee device is 240, how could it send and recieve commands in large networks of more than 240 devices?


Where are you getting this information from? It is not correct, the network address is 16b, so not limited to 240. Maybe you are getting confused with the Application EndPoint number which is 8b (with some reserved numbers)? If you are familiar with TCP/IP; then the loose analogy would be ZigBee Nwk Addr = IP Address (i.e. routing to a physical device) and ZigBee Application EndPoint = TCP Port number (i.e application on you physical device).

The limitation on number of devices in a ZigBee network is usually available memory for storing the routing tables. ZigBee has 2 routing protocols: 


AODV (Adhoc On Demand Vector) routing - Each device in the network has is own routing table (typically 40 devices) and each device can send a message to any other device, i.e. it is a mesh. The routing tables are maintained by broadcasting route requests. When a device not in the routing table is addressed it uses a route request to find the device and replaces a device in its routing table. This is typically limited to ~70-80 devices, beyond this and you end up with a "Route Request Storm" where all the available network BW is used by Route Request Broadcasts, which brakes good routes and causes more Route Requests.
MTO (Many To One)/Source Routing - The Routing path is in the messages, so each device does not need its own routing table. All device send messages to the "Concentrator", typically the Coordinator as well, i.e. this is a tree topology.


For more download Zstack-Home from http://www.ti.com/tool/z-stack (TI's ZigBee SDK) and refer to section "5. Routing" of Documents\Z-Stack Developer's Guide.pdf. 


  I know that if a device only wants to send periodic data to the coordinator it does not neccessarily need to bind to it. But if the coordinator was to lets say, switch 300 lights on and off from a connected PC. How could I do this within a ZigBee Pro network if I did not know the endpoint ID at compile time.


The Coord is always network address 0x0000, so yes you can always send a message to the Coord as you know its address, but the application on the Coord will have a Application Endpoint ID as well which you will need to know, so you have the same problem in both direection, but in the case where the Coord send a message it does not know the Network Address as well as the EndPoint. ZigBee offers a few different ways to solve this, but the one you need to look at is probably the Match Descriptor Request. The is a message that you can broadcast from a device to find out what devices on the network support a particular cluster. I.e. is the Coord want to find all the network address and endpoint of Lights then it would send a Match Descriptor Request the LIGHTING cluster, all the Lights would send a Match Descriptor Response with their Network Address and EndPoint ID.


  I have read that I can poll a device for information for what clusters it has available and perhaps it could provide me with the endpoints associated with these clusters. 


It sounds like you are describing the Match Descriptor Request/Response here, But what do you mean by 


  If this were the case, does that mean I would have to go through this query, processing, transmission loop everytime?


You application should build a list of all devices network address/endpoint, i.e. the Match Descriptor Response would be added to your list. When you want to send messages to all 'Lights' for instance you would iterate through you list of devices that responded the the Match Descriptor Request for the Lighting input cluster.

For more info on Cluster ID's see http://www.zigbee.org/download/standards-zigbee-cluster-library/.  

If you want to "play" with ZigBee commands like Match Desc and the Routing protocols then you can look at the "Command Line Trainer" example in https://git.ti.com/znp-host-framework/znp-host-framework.