It looks as though your attributed blocks are dynamic.
When the dynamic properties (e.g. Linear Parameters, Visibility State etc.) of a dynamic block reference are altered, the reference becomes anonymous, with a block name of the form
*U##. This is necessary since the appearance or geometry of the dynamic block reference may have changed and so the block must reference a new block definition containing this altered geometry (with everything linked back to the main dynamic block definition via dictionaries & xdata). Otherwise, if every block reference referenced the same block definition, all references would have identical geometry, as per a static block reference.
With this in mind, you will need to collect a selection set of all anonymous attributed block references in addition to those blocks matching your given block name, and then iterate over the selection set testing the effective name of each block reference. The effective name is the name of the original dynamic block definition for an anonymous dynamic block reference.
For example:
(if (setq sel (ssget "_X" '((0 . "INSERT") (2 . "`*U*,XY-LOC") (66 . 1))))
(repeat (setq cnt (sslength sel))
(setq obj (vlax-ename->vla-object (ssname sel (setq cnt (1- cnt))))
bnm (if (vlax-property-available-p obj 'effectivename)
(vla-get-effectivename obj)
(vla-get-name obj)
)
)
(if (= "XY-LOC" (strcase bnm))
... do your thing ...
)
)
)
Alternatively, you can collect the anonymous block names for the relevant dynamic block references, and include only these anonymous block names in the selection set filter; I describe this alternative technique
here.
EDIT: Irneb beat me to it