Most zoning codes require setbacks for any structure, so a coop wouldn't be exempt - reasons being everything from noise mitigation to maintenance access around the structure or beyond it. Some areas do allow coops to be placed up against buildings, or right up against a property fence, but...