Prevent publishing of uncategorized posts

The in_category function works only on existing (saved) posts. Here you can directly access the category in $postarr like this:

if ('affitti' == $postarr['post_category'])) {
  wp_die('Error: Posts cannot be published with the default category.');
  }

By the way, are you sure you want to use wp_die for this and not some other error message? People may loose their work if WP stops completely when they try to publish.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)