Attack them from behind with the Phantom Sword. Their front is effectively invulnerable, which is why hacking at them head-on does nothing.
Phantoms turn slowly, so the fight is about positioning rather than damage output. Get to their rear, strike, and move before they rotate to face you.
Set your spirit power to Ciela, the Spirit of Courage, and you gain the ability to fire shock waves. Aim one at a phantom's back and it lands the same hit without you having to close the distance at all. For players who find the melee approach fiddly with the stylus controls, this is considerably easier and just as effective.
Either method clears the door. The shock wave route is the one to use if you have already lost a few hearts learning the timing.