The online bookseller (or retailer) shows that it has several copies of my book in stock. Doesn't this mean that they have purchased it, and that therefore I should receive royalties?

No. This is known as a “virtual stock” policy. All copies of your book that are ordered by customers are through Print-on-Demand or filled through offset printing when this is applicable (generally for very large orders). An online bookseller’s (or retailer’s) policy of having “virtual stock” does not mean that your book has been purchased. It is a marketing tactic used by the online bookseller (or retailer) to generate purchases and show inventory.