  Aims. The purpose of this study is to examine the prediction that the
deuterated H3+ ion, H2D+, can be found exclusively in the coldest regions of
molecular cloud cores. This is also a feasibility study for the detection of
the ground-state line of ortho-H2D+ at 372 GHz with APEX.
  Methods. The 1(10)-1(11) transition of H2D+ at 372 GHz was searched towards
selected positions in the massive star forming cloud OriB9, in the dark cloud
L183, and in the low- to intermediate mass star-forming cloud R CrA.
  Results. The line was detected in cold, prestellar cores in the regions of
OriB9 and L183, but only upper limits were obtained towards other locations
which either have elevated temperatures or contain a newly born star. The H2D+
detection towards OriB9 is the first one in a massive star-forming region. The
fractional ortho-H2D+ abundances (relative to H2) are estimated to be about
1.0E-10 in two cold cores in OriB9, and 3.0E-10 in the cold core of L183.
  Conclusions. The H2D+ detection in OriB9 shows that also massive star forming
regions contain very cold prestellar cores which probably have reached matured
chemical composition characterized, e.g., by a high degree of deuterium
fractionation. Besides as a tracer of the interior parts of prestellar cores,
H2D+ may therefore be used to put contraints on the timescales related to
massive star formation.
