Did you try Edit Department and unticking Department active?

This from the Help:

Click this checkbox if the department is active. To make it inactive, turn this checkbox off by clicking it again to remove the checkmark and make the department inactive.

You can post to Active accounts. You cannot post to Inactive accounts. Therefore, transactions posted to inactive account/departments will be written to an error batch.