Let the sequence of values be realizations of random variables $X_i$, $1\le i\le n$, each identically distributed as a Bernoulli($p$) variable (with $p$ unknown). When they are independent, the sequence is a Markov chain with transition probabilities
$$\Pr(x \to 0) = 1-p, \quad \Pr(x \to 1) = p$$
for $x = 0,1$. The sequence yields $n-1$ (presumably) independent transitions $X_i \to X_{i+1}$, $1\le i\le n-1$, which can be summarized as a $2 \times 2$ matrix of their counts. Independence of the sequence implies independence of this table. So, test the table for independence and reject the hypothesis of an independent sequence if the test is significant.
For example, here is a sequence of 24 binary outcomes:
1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1 0 0 0
The 23 transitions in this sequence are 1->1, 1->1 , ..., 1->0, 0->0, 0->0. Their table of counts is
To: 0 1
From 0: 3 2
1: 3 15
Its chi-squared statistic is 1.8947. The p-value (using the chi-squared approximation, which is not very good due to the small cell counts in the table) is 0.1687: no evidence of dependence. Indeed, these 24 values were generated randomly and independently with a 2/3 chance of the outcome 1 and a 1/3 chance of a 0 (i.e., $p=2/3$).
If the hypothesis of independence is not rejected, you can continue to test for higher-order dependence or seasonal dependence (by checking transitions from season to season, rather than between consecutive values).
Here is sample R
code to compute the chi-squared test p-values for any desired order (1, 2, ...) and to simulate the null distribution (which can be used for a more accurate permutation test of the independence hypotheses if you wish).
set.seed(17)
x<-rbinom(256,1,2/3) # Sample data generated with the null distribution.
cc <- function(x,k) { # Chi-squared test of kth order independence in x.
n <- length(x)-k-1
m <- sapply(1:k, function(j) x[j:(n+j)])
y <- m %*% (2^(0:(k-1))) # Classifies length-k subsequences of x
chisq.test(y, x[(k+1):length(x)])$p.value
}
sapply(1:2, function(k) cc(x,k)) # P-values for chi-squared tests of orders 1, 2.
order <- 1 # Use 2 for second order, etc.
hist(replicate(999, cc(sample(x),order))) # Simulated null distribution of the p-value.