When Should AI Refuse to Answer? A Safe RAG Framework