Not right off the bat. I found that TARGET_SHIP_IGNORE_FLAGS is used by a variety of functions, but there doesn't seem to be a universal is_this_thing_targetable_from_here() function that I can slap in.
Probably not too hard to do, but more involved than I want to get right now (esp. with the code freeze going on). If someone's got plans for this in their mod, put it in the features request thread (or if you really really want it in the next release, put it in mantis.)
ai/aicode.cpp:
object_is_targetable is the function you want.
or if that is not exported, you can also use:
ship_is_visible_by_team(target, viewer)
or
awacs_get_level(target, viewer) > 1.0f;
Those are also used by the standard radar code.
Best Wishes,
Fabian