Assuming you want this to persist over multiple playthroughs, try something like the following.
First. Place the following in your StoryInit special passage:
<<if ndef $usedNames>>
<<set $usedNames to []>>
<</if>>
Next. In the passage that allows the player to choose a name do something like the following:
<<textbox "_name" "">> \
<<button "Continue">>
<<replace "#error-name">><</replace>>
<<set _name to _name.trim()>>
<<if _name is "">>
<<replace "#error-name">>Please specify a name.<</replace>>
<<elseif $usedNames.includes(_name.toLowerCase())>>
<<replace "#error-name">>_name is not available.<</replace>>
<<else>>
<<set $Name to _name>>
<<goto "Next Passage">>
<</if>>
<</button>>
@@#error-name;@@
Finally. In any passage where the player character dies do something like the following:
<<run $usedNames.pushUnique($Name.toLowerCase())>>
<<remember $usedNames>>
NOTE: The above code forces names to lower case for both the includes test and the list of used names. If you wish case to matter, then simply remove both instances of .toLowerCase().