Choose not to save an element on EVENT_BEFORE_SAVE_ELEMENT
This functionality or behavior is a bit confusing. The Elements Service has its own Events for saving Elements, specifically... but because ultimately Elements are just Yii Models, they have a discrete EVENT_BEFORE_SAVE event that uses a ModelEvent, which has the isValid property.

This is the point in the life-cycle where saving the Element can be prevented. The beforeSave method is called on the Element being saved (usually overridden in the actual Element implementation, but called + returned at the end of the subclass's method, like parent::beforeSave($isNew)), and the resulting boolean ($event-&gt;isValid) determines whether or not the saving continues.

So, in short: You can listen directly to the Entry's EVENT_BEFORE_SAVE event to prevent it from saving:

use craft\elements\Entry;
use craft\events\ModelEvent;

use yii\base\Event;

Event::on(
    Entry::class,
    Entry::EVENT_BEFORE_SAVE,
    function(ModelEvent $event) {
            $entry = $event-&gt;sender;
            if ($entry-&gt;sectionId == 5) {
                $event-&gt;isValid = false;
            }
        }
    });