You can get rid of the namespace and loop by using a select filter:
{% set area = area_name(trigger.entity_id) %}
{{ area_entities(area ) | select('match, 'light.') | list }}
But @Ben1983, you can also just use the Area ID in the light.turn_on action:
action: light.turn_on
target:
area_id: "{{ area_id(trigger.entity_id) }}"
Just be aware that applying actions across an entire Area can sometimes have unintended consequences. Some integrations and/or manufacturers will create light entities for things that you may not expect to be affected by your attempt to turn off room lights. These include indicator LEDs and screens/monitors.
Personally, I use Labels to mark lights that should be considered room lights for this type of automation.
Also, please follow Community Guidelines #14 and #11 by posting automations as YAML configuration, not screenshots.