I am adding a sub panel in an unattached building. My sub panel has the connection for the 2 hot wires coming from the source panel (a 40 amp double breaker) In addition it has one neutral/ground bar which has a green screw head for the ground and a row of places to connect neutrals. I am seeing advice on sites like yours to not connect the ground wire on the same bar as the neutral. So with only one bar I am not sure what to do with my ground wires. Do I need to install a second ground bar? I have the ground wire coming from the house that is well grounded through the house 200 amp service as well as a buried ground rods outside of the outbuilding. Do I use both and if so do I connect them both to the same ground bar?
The neutral and ground MUST NOT be bonded at a sub-panel. They should only be bonded at the main service panel. If you bond them anywhere other than the main service, the neutral return current now has multiple paths, including though your ground wire.
You should be able to buy a second bar for the sub-panel if it really is meant to be used as a sub-panel. The neutral bar will need to be isolated (it should have plastic insulator separating it from the case). The ground bar should be bonded to the case.
The ground wire from the house must be connected to the sub-panel ground. Since it is a detached building the ground rods are also required by code and should be tied to the sub-panel ground. The ground to the service is the most important because it will provide the low resistance path back to the service in case of a fault.