We report on a direct search for sub-GeV dark photons (A) which might be produced in the reaction e^- Z to e^- Z A via kinetic mixing with photons by 100 GeV electrons incident on an active target in the NA64 experiment at the CERN SPS. The As would decay invisibly into dark matter particles resulting in events with large missing energy. No evidence for such decays was found with 2.75cdot 10^{9} electrons on target. We set new limits on the gamma-A mixing strength and exclude the invisible A with a mass < 100 MeV as an explanation of the muon g_mu-2 anomaly.