Run this query to see if the issue is present:
SELECT 1 FROM SYS.AVAILABILITY_REPLICAS AS AR INNER JOIN SYS.DATABASES AS D ON DB_ID(N'xxxx') = D.DATABASE_ID AND AR.REPLICA_ID = D.REPLICA_ID INNER JOIN SYS.DM_HADR_AVAILABILITY_REPLICA_STATES ST ON AR.REPLICA_ID = ST.REPLICA_ID AND ST.ROLE = 2
If you receive the following, this confirms the issue.
Invalid object name 'SYS.AVAILABILITY_REPLICAS'.
This issue is resolved by the following Microsoft KB: http://support2.microsoft.com/kb/2983175