There is no direct method for an application to check whether a block listed in the BLOCK table is actually referenced by an insert object in the drawing. You can use the following code to scan the drawing for instances of a block reference:
(ssget "x" '((2 . "BLOCKNAME")) )
You must also scan each block definition for instances of nested blocks.