Ok, the book is set in a hotel or apartment building. The building has no 13th floor. But by drawing a hatch on the floor of the 14th floor, the kids can access the 13th, which leads to all sort of fascinating adventures, such as to the Milky Way. Pirates?
I saw that book when I was poking around yesterday, but aside from the 13th floor thing, none of the details matched with what was in the OP (no pirates, no outer space) and the kids don’t draw a hatch on the floor AFACT; instead the cat leads them to the 13th floor which is accessible only on the 13th of the month.
A story called “The Thirteenth Floor” was printed in the January 1949 edition of Weird Tales, but I doubt it’s the work that the OP remembers. Still, I read it once and just spent about fifteen minutes Googling it, so I figured I’d share the fruits of my labor.