This paper proposes a novel outlier detection (OOD) framework leveraging a large-scale vision-language model (VLM) to enhance the reliability of artificial intelligence (AI) systems in open-world environments. To overcome the limitations of existing prompt-learning-based OOD detection methods, which rely solely on softmax probabilities, we develop a context-optimized (CoOp) framework that leverages the discriminative power of feature embeddings. This framework projects in-distribution (ID) features onto a subspace spanned by prompt vectors and projects features unrelated to ID onto an orthogonal null space, thereby enhancing ID-OOD separation. Furthermore, we design an end-to-end learning criterion that ensures robust OOD detection performance and high ID classification accuracy. The effectiveness of the proposed method is demonstrated through experiments on real-world datasets.