The easiest way to hide the NPC dialog via server packet is to patch an existing (unused) hide window action via the MsgAction packet which does not require any hooking.
I'll be using client version 5579 as a reference:
MsgAction[Offset 4 = 116][Offset 8 = 3608] packet.
[Offset 8 = 3608] would normally hide the DowngradeEquipment window but instead we'll change the offset to hide the Npc dialog. You can use any other type as long as it hides a window.
We need to find the address offset for the CDlgTask which is a property in the CMyShellDlg class. In 5579 the CDlgTask offset is 0x1a6c90.
After we patch the client, sending MsgAction[Offset 4 = 116][Offset 8 = 3608] hides the task dialog window.