Instructions
Play through the S.S. Aqua until you get to the point where you wake up and defeat the sleeping sailor. The sailor will return to his post after you beat him in a Pokemon battle.
Return to the ship's basement. The sailor who was blocking your path previously has vanished, leaving you a clear route to the ladder on the left.
Climb the ladder to emerge near the Captain's Quarters. Enter the captain's room to find the lost little girl and the captain here. Speak to them both, and the girl will run away and try to hide again.
Exit the cabin and climb down the ladder.
Go all the way to the left side of the room near the juggler. You will see the girl hiding in a small passageway near the top left corner of the room. Speak to her and she will return to her grandfather.