We develop a transformation optics theory for the nonlocal media in the hydrodynamic Drude model by generalizing the free-electron current density equation to a transformation invariant form. Applying the transformation optics theory, perfectly matched layers (PMLs) for the nonlocal media are theoretically formulated and implemented in frequency domain with finite element method. The nonlocal PMLs are shown to absorb outgoing surface and volume plasmons without inducing unphysical reflections. The effectiveness of the nonlocal PMLs is quantitatively demonstrated by the behaviors that the numerical errors continuously approach zero with increasing linear mesh density.