How to put Curly Brace around only part of array

This is a solution using nested arrays and involves manual adjustments. I'll provide another automatic solution with blkarray package.

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\[
f_{i_k}(a)=
\begin{array}{c}
    \begin{array}{cccr}
        k = 1 & \,k = 2\, & \,k = 3 & \hspace{1.2em} \\
    \end{array}\\ 
    \left \{
    \begin{array}{|c|c|c|r}
        A'(a), & B(a), & C(a), &i=1 \\
        A(a), & B'(a), & C(a), &i=2 \\
        A(a), & B(a), & C'(a), &i=3
    \end{array}
    \right.
\end{array}
\]

\end{document}

enter image description here

Using \usepackage{blkarray}, this is another option:

\[
f_{i_k}(a) = 
\begin{blockarray}{ccccr}
  &k=1 & k=2 & k=3 & \\
  \begin{block}{@{}c\{@{}|c|c|c|r}
    &A'(a), & B(a) , & C(a) , & i=1 \\
    &A(a) , & B'(a), & C(a) , & i=2 \\
    &A(a) , & B(a) , & C'(a), & i=3 \\
  \end{block}
\end{blockarray}
\]

with a slightly different result:

enter image description here