How to hide certain fields to a user if they aren't referenced in a field on the node?
business logic never in tpl.

You could use hook_node_view($node, $view_mode, $langcode).

In my opinion the cleanest and the most drupal way would be to create a custom formatter (mymodule_field_formatter_info) in which you should pass
the returned value (1 or 0) of your business logic to the #access property of the field

Regards.