A book is out of print if the publisher isn’t selling copies anymore.
But it’s trickier than that!
Some retailers may still have copies; nobody keeps track of all the books that are in all the different retailers.
Also, some books that used to be out of print have been digitized and are available as ebooks or print-on-demand books.