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.
Changes to the Electrical Code now REQUIRE all unattached buildings with sub panels, to have the Neutral Bar Grounded with #6 wire to the panel box then to a grounding rod in the earth. (Rule 10-208)
You CANNOT use the ground included in say #10/3 wire as your sub panel ground anymore.
You are to treat the sub panel just as a service that is coming in from the meter, the only conductors that should be entering your sub panel now are your 2 Hot Feeds, and your Neutral. (no ground from the main panel.)
Now the confusing part, Rule 10-208 (b) states that you can ground any metal non current carrying components (outlet boxes) through a separate conductor back to the main panel if the building does not house livestock. However, since you must now have a bonded neutral in sub panels, this is more of a pain to attempt since you have a separate grounding circut right there already.