How to hide form fields in twig template?

you can use HiddenType, or hide field in template:

{{ form_start(form) }}
    {% if someValue == true %}
        {{ form_widget(form.fieldName) }}
    {% else %}
        {{ form_widget(form.fieldName, { 'attr': {'class': 'hidden-row'} }) }}
    {% endif %}
    {# other fields... #}
{{ form_end(form) }}

or you can use FormEvents like FormEvents::PRE_SET_DATA in FormType. (doc)

You can prevent any output for the form field by pretending, that it was already rendered:

{{ form_start(form) }}
    {% if someValue == true %}
        {% do form.fieldName.setRendered() %}
    {% endif %}
{{ form_end(form) }}