How do you name something that isn't in your inventory?

In Nethack 3.6.0, you can name objects on the floor by using #name and selecting "floor".

Prior to version 3.6.0, it was not possible to #name an item that is not in your inventory.

In the case of loadstones, the traditional method was to identify the other three gray stones first and just leave it at that. Failing that, a spare uncurse is a handy way to just be done with it and not have to worry.