The scarf is there to mute the strings above the nut - when you’re hammering like this they can ring with unpleasant discordant harmonics.
Also to look cool.