A search is presented for a Higgs boson that is produced in association with a Z boson and that decays to an undetected particle together with an isolated photon. The search is performed by the CMS Collaboration at the Large Hadron Collider using a data set corresponding to an integrated luminosity of 137 fb−1 recorded at a center-of-mass energy of 13 TeV. No significant excess of events above the expectation from the standard model background is found. The results are interpreted in the context of a theoretical model in which the undetected particle is a massless dark photon. An upper limit is set on the product of the cross section for associated Higgs and Z boson production and the branching fraction for such a Higgs boson decay, as a function of the Higgs boson mass. For a mass of 125 GeV, assuming the standard model production cross section, this corresponds to an observed (expected) upper limit on this branching fraction of 4.6 (3.6)% at 95% confidence level. These are the first limits on Higgs boson decays to final states that include an undetected massless dark photon. [Figure not available: see fulltext.].