if you're using skbee, just get the bossbars of the player and see if the list contains the one you're looking for
Skript Hub - Documentation
Get a BossBar from an entity (such as a wither) or all BossBars of players.
NOTE: BossBars from entities cannot be saved in global variables, as the entity may not be loaded on the
server when that variable is trying to load. Custom BossBars and BossBars from players can be saved in variables.