They don't have to be in a trench, it depends on the situation.No.
see 250.53(A)(4) - horizontal rods can only be installed in a trench and be code compliant
250.53(G)
(G) Rod and Pipe Electrodes. The electrode shall be installed
such that at least 2.44 m (8 ft) of length is in contact
with the soil. It shall be driven to a depth of not less than
2.44 m (8 ft) except that, where rock bottom is encountered,
the electrode shall be driven at an oblique angle not
to exceed 45 degrees from the vertical or, where rock bottom
is encountered at an angle up to 45 degrees, the electrode shall
be permitted to be buried in a trench that is at least 750 mm
(30 in.) deep. The upper end of the electrode shall be flush
with or below ground level unless the aboveground end and
the grounding electrode conductor attachment are protected
against physical damage as specified in 250.10.
Roger