Community
About 6 years too late but...
Try enter a single period before the command name, i.e. ".CMD1".
Preceding a command name with a period (.) ensures that the built-in AutoCAD command is accessed, and not an application-defined command of the same name that has been defined to override the built-in command using UNDEFINE.
For example if you use the UNDEFINE command on the CIRCLE command, you can still access the command by preceding the command name with a period, i.e. ".CIRCLE".
So it looks like the CommandFlags.Undefined enum automatically undefines the command.