Here's how you get past it:
1. Learn the Riddikulus spell: You'll encounter a Dementor in the Forbidden Forest and learn the spell from Professor Lupin.
2. Use Riddikulus on the Dementor: You'll need to aim your spell at the Dementor and cast Riddikulus to make it retreat.
3. The door will open: Once the Dementor is defeated, the door in the Forbidden Forest will open, allowing you to proceed.
Let me know if you have any other questions about Lego Harry Potter!